#include "env.h"
#include "translate.h"

E_enventry E_VarEntry(Tr_access access, Ty_ty ty)
{
    E_enventry p = checked_malloc(sizeof(*p));
    p->kind = E_varEntry;
    p->u.var.access = access;
    p->u.var.ty = ty;
    return p;
}

E_enventry E_FunEntry(Tr_level level, Temp_label label, Ty_tyList formals, Ty_ty result)
{
    E_enventry p = checked_malloc(sizeof(*p));
    p->kind = E_funEntry;
    p->u.fun.level = level;
    p->u.fun.label = label;
    p->u.fun.formals = formals;
    p->u.fun.result = result;
    p->u.fun.imped = FALSE;
    return p;
}

void E_tenter(S_table t, S_symbol sym, Ty_ty type)
{
    TAB_enter(t, sym, type);
}

void E_venter(S_table t, S_symbol sym, E_enventry entry)
{
    TAB_enter(t, sym, entry);
}
